import xhsJson from "./xiaohongshu";
import douyin from "./douyin";
import instagram from "./instagram";

export const json = (input: string) => {
  const regex = /(https?:\/\/[^\s|，|,| ]+)/g;
  const urls = input.match(regex);
  const url = urls ? urls[0] : input;
  if (url.includes("douyin")) return douyin(url);
  else if (url.includes("instagram")) return instagram(url);
  else return xhsJson(url);
};
